package com.yb.core.util;

import com.yb.core.constant.DateTimeConstant;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/5/10 14:33
 * FileName: PathUtil
 * Description:
 */
public class PathUtil {
    public static String getCurrentTimeFolder(){
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern(DateTimeConstant.SLASH_PATTERN_DATE);
        LocalDateTime localDateTime = LocalDateTime.now();
        String dateStr = localDateTime.format(fmt);
        return dateStr;
    }

    /**
     * 根据md5获取时间序列
     * @param md5
     * @return
     */
    public static String getChunkFolder(String md5){
        StringBuilder sb = new StringBuilder();
        sb.append(md5.charAt(0))
        .append("/")
        .append(md5.charAt(1))
        .append("/")
        .append(md5);
        return sb.toString();
    }
}
